import os.path

def listdirectory2(path): 
    fichier=[] 
    for root, dirs, files in os.walk(path): 
        for i in files: 
            fichier.append(os.path.join(root, i)) 
    return fichier

def gen1():
    for f in listdirectory2("."):
	if (f.find("svn")+f.find(".py"))== -2:
	    f = f.replace(".java","")
	    lastChar = f[-1]
	    fileBase = f[:-1][2:]
	    if lastChar == 'S':
		#print fileBase+'S'+" "+fileBase[1:]+"= new fileBase+'S'();"
		print fileBase+"S "+fileBase[:1].lower()+fileBase[1:]+"S = new "+fileBase+"S();"
		print fileBase[:1].lower()+fileBase[1:]+"S.setComposant(this);"
		print "addService("+fileBase[:1].lower()+fileBase[1:]+"S);"
		print fileBase[:1].lower()+fileBase[1:]+"S.getPort().setComposant(this);"
		print "addPort("+fileBase[:1].lower()+fileBase[1:]+"S.getPort());"
		print ""

gen1()